package org.example.repository;

import org.example.entity.UserSessionDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

/**
 * <p>
 *   用户会话信息Repository
 * </p>
 * @author jinshihui
 */
@Repository
public interface UserSessionRepository extends JpaRepository<UserSessionDO, String> {
    boolean existsBySessionId(String sessionId);

    @Query("SELECT s FROM UserSessionDO s WHERE s.sessionId = ?1")
    UserSessionDO findBySessionId(String sessionId);
}